<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class AddCloumnNameIdToContentMenu extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('content_menu', function (Blueprint $table) {
            $table->string('name_id', 100)->nullable(false)->after('name')->comment('唯一标识');
            $table->unique('name_id', 'uk_name_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('content_menu', function (Blueprint $table) {
            $table->dropColumn('name_id');
        });
    }
}
